package leetcode.code190.ReverseBits;

public class Solution19001 extends ReverseBits {

	@Override
	public int reverseBits(int n) {
		int count = 31;
		int res = 0;
		while (n != 0) {
			int last = n & 1;
			if (last == 1) {
				int temp = count;
				while (temp != 0) {
					last <<= 1;
					temp--;
				}
				res ^= last;
			}
			count--;
			n >>>= 1;
		}
		return res;
	}

	public static void main(String[] args) {
		int x = 0b11111111111111111111111111111111;
		System.out.println(x);
		Solution19001 so = new Solution19001();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();
	}

}
